using IcsSEMCtrl.Util;
namespace Lifter.Global.Device
{
    public class HandOffType
    {
        public const int _MGV = 1;
        public const int _AGV = 2;
        public const int _RGV = 3;
        private int _value;
        private static int _size;
        private static HandOffType[] _array;
        public static string[] displayStrings;
        public static HandOffType[] displayValues;
        public static HandOffType MGV;
        public static HandOffType AGV;
        public static HandOffType RGV;
        public static HandOffType IT_ENUM_MAX;
        static HandOffType()
        {
            HandOffType._size = 4;
            HandOffType._array = new HandOffType[HandOffType._size];
            HandOffType.displayStrings = new string[HandOffType._size];
            HandOffType.displayValues = new HandOffType[HandOffType._size];
            HandOffType.MGV = new HandOffType(1);
            HandOffType.AGV = new HandOffType(2);
            HandOffType.RGV = new HandOffType(3);
            HandOffType.IT_ENUM_MAX = new HandOffType(2147483647);
            HandOffType.displayStrings[1] = "MGV";
            HandOffType.displayStrings[2] = "AGV";
            HandOffType.displayStrings[3] = "RGV";
            HandOffType.displayValues[1] = HandOffType.MGV;
            HandOffType.displayValues[2] = HandOffType.AGV;
            HandOffType.displayValues[3] = HandOffType.RGV;
        }
        public static string ValueToString(HandOffType val)
        {
            string result;
            switch (val.Value())
            {
                case 1:
                    result = HandOffType.displayStrings[1];
                    break;
                case 2:
                    result = HandOffType.displayStrings[2];
                    break;
                case 3:
                    result = HandOffType.displayStrings[3];
                    break;
                default:
                    result = "";
                    break;
            }
            return result;
        }
        public static HandOffType StringToValue(string val)
        {
            HandOffType result;
            if (Helper.IsNullOrEmpty(val))
            {
                result = HandOffType.IT_ENUM_MAX;
            }
            else
            {
                for (int i = 1; i < HandOffType.displayStrings.Length; i++)
                {
                    if (val.Equals(HandOffType.displayStrings[i]))
                    {
                        result = HandOffType.displayValues[i];
                        return result;
                    }
                }
                result = null;
            }
            return result;
        }
        public int Value()
        {
            return this._value;
        }
        public static HandOffType From_Int(int value)
        {
            HandOffType result;
            if (value >= 1 && value < HandOffType._size)
            {
                result = HandOffType._array[value];
            }
            else
            {
                result = HandOffType.IT_ENUM_MAX;
            }
            return result;
        }
        protected HandOffType(int value)
        {
            this._value = value;
            if (value >= 1 && value < HandOffType._size)
            {
                HandOffType._array[this._value] = this;
            }
        }
        public bool Equals(HandOffType otherEnum)
        {
            return otherEnum.Value() == this._value;
        }
        public override string ToString()
        {
            return HandOffType.displayStrings[this._value];
        }
    }
}
